package array;

import queue.Queue;

public class MyQueue<E> implements Queue<E> {

    private MyArray<E> array;

    public MyQueue(int capacity){
        array = new MyArray<E>(capacity);
    }

    public MyQueue(){
        array = new MyArray<E>();
    }


    //入队：从队尾入队
    @Override
    public void enqueue(E e) {
        array.addLast(e);
    }

    //出队：从队首出对
    @Override
    public E dequeue() {
        return array.removeFirst();
    }

    //获取队首元素
    @Override
    public E getFront() {
        return array.getFirst();
    }

    @Override
    public int getSize() {
        return array.getSize();
    }

    @Override
    public boolean isEmpty() {
        return array.isEmpty();
    }

    public int getCapacity(){
        return array.getCapacity();
    }
}
